package com.test.design.callback;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Client {

	public static void main(String[] args) {
		List<String> l = getA("a", 11);
		System.out.println(l);
		List<Object> l1 = getB("b", 22, new Date());
		System.out.println(l1);
	}

	public static List<String> getA(String a, long b) {
		class A implements Exceutor<String> {
			private String a;
			private long b;

			public A(String a, long b) {
				this.a = a;
				this.b = b;
			}

			public List<String> execute() {
				System.out.println("a=" + a + ",b=" + b);
				List<String> l = new ArrayList<String>();
				l.add(a);
				return l;
			}
		}
		List<String> list = new Template<String>().getList(new A(a, b));
		return list;
	}

	public static List<Object> getB(String a, long b, Date d) {
		class A implements Exceutor<Object> {
			private String a;
			private long b;
			private Date d;

			public A(String a, long b, Date d) {
				this.a = a;
				this.b = b;
				this.d = d;
			}

			public List<Object> execute() {
				System.out.println("a=" + a + ",b=" + b + ",d=" + d);
				List<Object> l = new ArrayList<Object>();
				l.add(a);
				l.add(d);
				return l;
			}
		}
		return new Template<Object>().getList(new A(a, b, d));
	}

}
